package research.toe.duangjarern.Helper;

import android.util.Log;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import java.io.IOException;

/**
 * Created by nipitponmuensan on 2/26/15 AD.
 */
public class NetWorkHelper {

    public static final String INTERNET_CONNECTION = "";
    public static final String QUESTIONAIR_CONNECTION = "";
    //public final String TEST_CONNECTION = "";

    public static boolean startCheck(String urltype) {

        HttpClient httpclient = new DefaultHttpClient();
        HttpGet httpget = new HttpGet("http://www.google.co.th");

        HttpResponse response = null;
        try {
            response = httpclient.execute(httpget);
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            Log.e("Network exception :", e.getMessage());
            return false;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            Log.e("Network exception :", e.getMessage());
            return false;
        }
        HttpEntity entity = response.getEntity();

        if (entity.isStreaming()) {
            Log.d("entity.isStreaming()", "ture");
            return true;
        } else {
            return false;
        }
    }


}